$.get(
  "http://chst.vip:1234/api/getcoupon",
  {},
  (res) => {
    let html = "";
    $(res.result).each((i, item) => {
      html += `<div couponId=${item.couponId} > ${item.couponTitle} </div>`;
    });
    $(".contenttop").html(html);
  },
  "json"
);

$(".contenttop").on("click", "div", function () {
  let couponid = $(this).attr("couponId");
  location.href = ` ./couponproduct.html?couponid=${couponid}`;
});
